13. Fetch API
Fetch API
1.12 Fetch API Quiz
Instructions
First, if you haven't already, read this and follow the instructions on working with the Exoplanet Explorer repo.
- Checkout the
fetch-startbranch and navigate toapp/scripts/app.js. - Rewrite
getwith the Fetch API: https://davidwalsh.name/fetch - Finish the
getJSON()method, which should take a URL and return the parsed JSON response.getJSON()needs to return a Promise!
- Test by logging the response and by passing the query string from
getJSON()toaddSearchHeader(). - Handle errors by passing
'unknown'toaddSearchHeader()and logging them.
Checkout the fetch-solution branch to see my code.
Solution
1.12 Fetch API Solution